import ProductIndex from '@/components/product/index.vue'
import ProductInfo from '@/components/product/info.vue'
import CartIndex from '@/components/product/cart.vue'
import ClientIndex from '@/components/product/client.vue'
import Confirm from '@/components/product/confirm.vue'
import Confirminfo from '@/components/product/confirminfo.vue'

//定义一个路由列表(子路由)
const list = [
    {
        name: 'ProductIndex',
        path: 'index',
        component: ProductIndex,
    },
    {
        name: 'ProductInfo',
        path: 'info',
        component: ProductInfo,
    },
    {
        name: 'CartIndex',
        path: 'cart',
        component: CartIndex,
        //进入购物车页面，对用户的登录状态进行验证
        meta:{login:true}
    },
    {
        name: 'ClientIndex',
        path: 'client',
        component: ClientIndex,
    },
    {
        name: 'Confirm',
        path: 'confirm',
        component: Confirm,
        meta:{login:true}
    },
    {
        name: 'Confirminfo',
        path: 'confirminfo',
        component: Confirminfo,
        meta:{login:true}
    },
]

//父级的组件模板
const layout = {
    template: `<router-view></router-view>`
}

export default [
    {
        name: 'product',
        path: '/product',
        component: layout,
        children: list
    }
]